const defaultEnv: Env = {
  PKG_PREFIX: '/pkg/',
  CDN_BASE_URL: 'https://cdn.jsdelivr.net/npm/',
};

const customEnv: Partial<Env> = {};

export const setupEnv = (env: Partial<Env>) => {
  Object.assign(customEnv, env);
};

export const getEnv = <K extends keyof Env>(key: K, dft: Env[K]): Env[K] =>
  customEnv[key] || defaultEnv[key] || dft;
